home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 16 / AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso / pd / anwendungen / ispell-3.1.18src / makepatch (.txt) < prev    next >
Microsoft Windows Help File Content  |  1994-11-02  |  7KB  |  206 lines

  1. : Use /bin/sh
  2. # $Id: Makepatch,v 1.16 1994/11/01 05:54:33 geoff Exp $
  3. # Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
  4. # All rights reserved.
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions
  7. # are met:
  8. # 1. Redistributions of source code must retain the above copyright
  9. #    notice, this list of conditions and the following disclaimer.
  10. # 2. Redistributions in binary form must reproduce the above copyright
  11. #    notice, this list of conditions and the following disclaimer in the
  12. #    documentation and/or other materials provided with the distribution.
  13. # 3. All modifications to the source code must be clearly marked as
  14. #    such.  Binary redistributions based on modified source code
  15. #    must be clearly marked as modified versions in the documentation
  16. #    and/or other materials provided with the distribution.
  17. # 4. All advertising materials mentioning features or use of this software
  18. #    must display the following acknowledgment:
  19. #      This product includes software developed by Geoff Kuenning and
  20. #      other unpaid contributors.
  21. # 5. The name of Geoff Kuenning may not be used to endorse or promote
  22. #    products derived from this software without specific prior
  23. #    written permission.
  24. # THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
  25. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27. # ARE DISCLAIMED.  IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
  28. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  30. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  31. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  33. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  34. # SUCH DAMAGE.
  35. #    Make an ispell patch kit.  This is not a clever script,
  36. #    just a handy one.
  37. #    Usage:
  38. USAGE="Usage:  Makepatch [-n] [-d destdir] [-o file] ... [new-files]"
  39. #    destdir is the directory in which the kits and patches are kept.
  40. #    new-files are any new files to be added to the distribution.
  41. #    The -n switch suppresses RCS updates, so that the patch can be
  42. #    tested.
  43. #    The -o switch can be used to limit patching to certain files.
  44. #    This is useful to control the size of patches.  Version.h is
  45. #    always patched.  This switch can appear more than once.
  46. # $Log: Makepatch,v $
  47. # Revision 1.16  1994/11/01  05:54:33  geoff
  48. # When doing a partial run, update the fields code in the right RCS
  49. # directory.
  50. # Revision 1.15  1994/11/01  05:27:14  geoff
  51. # Change the special code for handling the fields routines to reflect my
  52. # latest source-tree reorganization.
  53. # Revision 1.14  1994/05/18  02:56:48  geoff
  54. # Correctly detect dictionary files for context selection
  55. # Revision 1.13  1994/05/17  06:37:27  geoff
  56. # Add the -o switch, to help handle overly-large patches.  Remember to
  57. # return a success status at the end (rcsdiff can return a nonzero
  58. # status).
  59. # Revision 1.12  1994/02/08  06:03:56  geoff
  60. # Don't expect a comma after version number (it makes patch barf)
  61. # Revision 1.11  1994/01/25  07:11:15  geoff
  62. # Get rid of all old RCS log lines in preparation for the 3.1 release.
  63. destdir=kits
  64. baserelease=3.1
  65. trialrun=
  66. files=
  67. partialrun=false
  68. while [ $# -gt 0 ]
  69.     case "$1" in
  70.         destdir="$2"
  71.         shift; shift
  72.         ;;
  73.         trialrun=echo
  74.         shift
  75.         ;;
  76.         files="$files $2"
  77.         partialrun=true
  78.         shift; shift
  79.         ;;
  80.         echo "$USAGE" 1>&2
  81.         exit 1
  82.         ;;
  83.         break
  84.         ;;
  85.     esac
  86. allfiles=`Makekit -e`
  87. if $partialrun
  88.     :
  89.     files="$allfiles"
  90. [ -d "$destdir" ]  ||  mkdir "$destdir"
  91. if [ -r "$destdir/Patch${baserelease}.01" ]
  92.     lastpatch=`ls $destdir/Patch${baserelease}.?? | tail -1 \
  93.       | sed "s;$destdir/Patch${baserelease}.;;"`
  94.     lastpatch=00
  95. patchno=`expr $lastpatch + 1`
  96. case "$patchno" in
  97.     [1-9])
  98.     patchno=0$patchno
  99. patchfile="$destdir/Patch${baserelease}.$patchno"
  100. case "$trialrun" in
  101.     echo)
  102.     patchfile="${patchfile}-test"
  103. lastpatchid=`echo Patch${baserelease}.$lastpatch | sed 's/\./_/g'`
  104. patchid=`echo Patch${baserelease}.$patchno | sed 's/\./_/g'`
  105. echo 'Index: version.h' > "$patchfile"
  106. prereq=`co -r$lastpatchid -p RCS/version.h \
  107.   | egrep 'International Ispell Version' \
  108.   | sed -e 's/^.*International Ispell Version //' -e 's/ .*$//'`
  109. echo "Prereq: $prereq" >> "$patchfile"
  110. echo "" >> "$patchfile"
  111. patchlevel=`egrep "International Ispell Version $baserelease" version.h \
  112.   | sed -e "s/^.*Version $baserelease\.//" -e 's/ .*$//'`
  113. case "$patchlevel" in
  114.     $patchno)
  115.     $lastpatch)
  116.     $trialrun co -l version.h
  117.     # Note this requires System V date command!
  118.     date=`date +%D`
  119.     co -p -q version.h \
  120.       | sed "/International/s;$baserelease.$lastpatch ../../..;$baserelease.$patchno $date;" \
  121.       | case "$trialrun" in
  122.         '')
  123.             cat > version.h
  124.             ;;
  125.         echo)
  126.             echo 'Edit version.h to produce:'
  127.             egrep 'International Ispell Version'
  128.             ;;
  129.         esac
  130.     *)
  131.     echo "Sorry, I can't figure out what level you're patching!" 1>&2
  132.     exit 1
  133. lastrev=`rlog -h version.h | sed -n 's/head:[     ]*//p'`
  134. if $partialrun
  135.     $trialrun rcs -N$patchid:$lastpatchid \
  136.       `echo $allfiles | tr ' ' "$nl" \
  137.         | sed '/^fields.[ch3]$/s;^;'"$HOME/src/local/fields/;"`
  138. case "$trialrun" in
  139.     '')
  140.     rcs -N$patchid:$lastrev version.h
  141.     rcsdiff -r$lastpatchid -r$patchid version.h >> "$patchfile"
  142.     echo)
  143.     echo rcs -N$patchid:$lastrev version.h
  144.     rcsdiff -r$lastpatchid version.h >> "$patchfile"
  145. for basefile in $files
  146.     case "$basefile" in
  147.     fields.[ch3])
  148.         rcsfile=$HOME/src/local/fields/RCS/$basefile,v
  149.         ;;
  150.         rcsfile=`rlog -R $basefile`
  151.         ;;
  152.     esac
  153.     lastrev=`rlog -h $rcsfile | sed -n 's/head:[     ]*//p'`
  154.     case "$basefile" in
  155.     version.h)
  156.         ;;
  157.         $trialrun rcs -N$patchid:$lastrev $rcsfile
  158.         case "$trialrun" in
  159.         '')
  160.             changes=`rcsdiff -r$lastpatchid -r$patchid $rcsfile \
  161.             $basefile 2>/dev/null \
  162.               | sed 1q`
  163.             ;;
  164.         echo)
  165.             changes=`rcsdiff -r$lastpatchid $rcsfile $basefile \
  166.             2>/dev/null \
  167.               | sed 1d`
  168.             ;;
  169.         esac
  170.         case "$changes" in
  171.         '')
  172.             ;;
  173.             case "$basefile" in
  174.             languages/english/*.[0-9])
  175.                 context=
  176.                 ;;
  177.             *)
  178.                 context=-u
  179.                 ;;
  180.             esac
  181.             echo "" >> "$patchfile"
  182.             echo "Index: $basefile" >> "$patchfile"
  183.             echo "" >> "$patchfile"
  184.             case "$trialrun" in
  185.             '')
  186.                 rcsdiff $context -r$lastpatchid -r$patchid \
  187.                 $rcsfile $basefile \
  188.                   >> "$patchfile"
  189.                 ;;
  190.             echo)
  191.                 rcsdiff $context -r$lastpatchid $rcsfile \
  192.                 $basefile \
  193.                   >> "$patchfile"
  194.                 ;;
  195.             esac
  196.             ;;
  197.         esac
  198.     esac
  199. # Do new files
  200. for basefile
  201.     echo "" >> "$patchfile"
  202.     echo "Index: $basefile" >> "$patchfile"
  203.     echo "" >> "$patchfile"
  204.     diff -c /dev/null $basefile | sed "s;/dev/null;$basefile;" >> "$patchfile"
  205. exit 0
  206.